package user.zc.excel.data.info;

import user.zc.helper.ExcelAssistant;
import user.zc.excel.data.style.TitleStyle;

public class TitleCell<T> implements ICell<Class<T>>{
    @Override
    public CellInfo parse(Class<T> t) {
        ExcelAssistant excelAssistant =  (ExcelAssistant) t.getAnnotation(ExcelAssistant.class);
        if(excelAssistant!=null){
            CellInfo cellInfo = new CellInfo();
            cellInfo.setData(excelAssistant.title());
            cellInfo.setCellType(CellType.STRING.getValue());
            cellInfo.setStyleInfo(new TitleStyle().parse(excelAssistant.column()));
            return cellInfo;
        }else {
            return null;
        }
    }
}
